<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java"  
    import ="com.jju.A1541.model.*"
    import ="com.jju.A1541.dao.*"
    contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%
       //1.获得表单的输入
       String zplx = request.getParameter("zplx");
       String qtfl  = request.getParameter("qtfl");
       String syfs = request.getParameter("syfs");
       String qsld = request.getParameter("qsld");
       String zpxq = request.getParameter("zpxq");
       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd ");//设置日期格式
       String time = df.format(new Date());
       String jzsj = time;
       zplx= new String(zplx.getBytes("ISO-8859-1"),"UTF-8");
       qtfl= new String(qtfl.getBytes("ISO-8859-1"),"UTF-8");
       syfs= new String(syfs.getBytes("ISO-8859-1"),"UTF-8");
       qsld= new String(qsld.getBytes("ISO-8859-1"),"UTF-8");
       zpxq= new String(zpxq.getBytes("ISO-8859-1"),"UTF-8");
       //2.创建捐赠实体类Zp对象并进行赋值
         Zp  obj = new 	Zp();
          obj.setZplx(zplx);
          obj.setQtfl(qtfl);
          obj.setSyfs(syfs);
          obj.setQsld(qsld);
          obj.setZpxq(zpxq);
          obj.setJzsj(jzsj);
       //3.调用ZpDAO完成实体对象的持久化--保存到数据库表中
       int n = ZpDAO.add(obj);
       
       //4..对结果的处理
        if(n>0){
        	out.print("<script>alert('捐赠成功'); window.location='products.jsp' </script>");
        }else{
        	out.print("<script>alert('捐赠失败'); window.location='donate.html' </script>");
        }
       %>